package com.mgface.mrmdb.reids;

import java.text.MessageFormat;
import java.util.HashSet;
import java.util.Set;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisSentinelPool;

public class JedisTest {
	public  static void print(Object value){
	System.out.println(MessageFormat.format("value:{0}", value));
	}
	public static void main(String[] args) throws InterruptedException {
		Set<String> sentinels = new HashSet<>();
		sentinels.add("192.168.56.101:9100");
		sentinels.add("192.168.56.101:9101");
		sentinels.add("192.168.56.101:9102");
		JedisSentinelPool jedisSentinelPool = new JedisSentinelPool("mymaster", sentinels);
		Jedis jedis = jedisSentinelPool.getResource();
		print(jedis.get("foo"));
		print(jedis.set("fool", "a", "nx", "ex", 10));
	}
}
